//
//  VideoView.h
//  播放器模拟(列表)
//
//  Created by lanou3g on 15/11/2.
//  Copyright © 2015年 songhaowen. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
@class VideoView;


typedef NS_ENUM(NSInteger, VideoPlayerPlaybackState) {
    VideoPlayerPlaybackStateStopped = 0,//播放结束状态
    VideoPlayerPlaybackStatePlaying,//正在播放状态
    VideoPlayerPlaybackStatePaused,//暂停播放状态
    VideoPlayerPlaybackStateFailed,//播放失败状态(视频损坏或无法识别)
};


@protocol  VideoViewDelegate <NSObject>
@optional
- (void)canStartPlaying:(VideoView *)slVideoView;
- (void)networkNotBest:(VideoView *)slVideoView;
- (void)dontPlayer:(VideoView *)slVideoView;
- (void)bufferTimeLength:(CGFloat)time;
- (void)currentPlayerTimeLength:(CGFloat)time;
- (void)playEnd:(VideoView *)slVideoView;
@end

@interface VideoView : UIView

@property (nonatomic, copy) NSString *contentUrl;
@property (nonatomic, assign) id<VideoViewDelegate> delegate;
@property (nonatomic, assign) VideoPlayerPlaybackState playState;
@property (nonatomic, strong) AVPlayer *player;
@property (nonatomic, strong) AVPlayerItem *playerItem;
@property (nonatomic, assign) CGFloat totalTime;
@property (nonatomic, assign) CGFloat currentTime;
@property (nonatomic, assign) CGFloat timeScale;
@property (nonatomic, strong) AVPlayerLayer *playerLayer;
@property (nonatomic, strong) id obj;

- (void)speed:(CMTime)speedTime;


@end
